const DButil = require('./DButil');

// 管理员登录功能
function adminLogin(aacount, apwd, success, fail){
    let connection = DButil.createConnection();
    connection.connect();
    let sql = 'select * from administrator where aaccount=? and apwd=?;';
    let params = [aacount, apwd]
    connection.query(sql, params, (err, result) => {
        if (err) {
            fail(err);
        }else{
            success(result);
        }
    })
    connection.end();
}

module.exports.adminLogin = adminLogin;